import request from '@/utils/request'

export default {
  addCourse(courseInfoForm) {
    return request({
      url: '/eduservice/course/',
      method: 'post',
      data : courseInfoForm
    })
  },

  updateCourse(courseInfoForm) {
    return request({
      url: `/eduservice/course/${courseInfoForm.id}`,
      method: 'put',
      data : courseInfoForm
    })
  },

  getCourse(id) {
    return request({
      url: `/eduservice/course/${id}`,
      method: 'get',
    })
  },

  getCoursesCondition(current, size, courseQuery) {
    return request({
      url: `/eduservice/course/coursesCondition/${current}/${size}`,
      method: 'post',
      data: courseQuery
    })
  },

  getCoursePublic(id) {
    return request({
      url: `/eduservice/course/getPublish/${id}`,
      method: 'get',
    })
  },
  publishCourse(id) {
    return request({
      url: `/eduservice/course/publish/${id}`,
      method: 'get',
    })
  },

  removeCourse(id) {
    return request({
      url: `/eduservice/course/${id}`,
      method: 'delete'
    })
  }
}

